<template>
  <div>
    <van-nav-bar
        title="工单详情"
        left-text="返回"
        left-arrow
        @click-left="$router.go(-1)"
    />
    <div class="content">
      <van-cell-group>
        <van-cell title="工单类型" :value="this.order.type" />
        <van-cell title="工单状态" :value="this.order.status"/>
        <van-cell title="项目名称" :value="this.order.engineer_name"/>
        <van-cell title="设备名称" :value="this.order.device_name"/>
        <van-cell title="申报原因" :value="this.order.bill_why === null?'无':this.order.bill_why"/>

      </van-cell-group>
      <Complete :sub="order"></Complete>
      <!--<div style="margin-top: 20px">
        <van-button type="info" @click="toConfirmHandler" style="width: 100%">确认完成</van-button>
      </div>-->
    </div>
  </div>
</template>
<script>
import { get } from "@/utils/request.js";
import { mapState } from "vuex";
import { Dialog, Notify } from "vant";
import Complete from "@/views/manager/Complete";

export default {
  components:{
    Complete
  },
  data() {
    return {
      order: {},
      engineer: {
        engineer_id: null,
        page: 1,
        pageSize: 1,
      },
    };
  },
  computed: {
    ...mapState("user", ["info"]),
  },
  methods: {
    // 确认接单按钮
    toConfirmHandler() {
      Dialog.confirm({
        title: "友情提示",
        message: "是否确认完成",
      }).then(() => {
        get("/workorder/finishOrder", {
          id: this.order.id,

        }).then((res) => {
          // 提示成功
          Notify({ type: "success", message: "工单完成" });
          // 跳转至我的工单
          this.$router.push({
            path: "/manager/order",
          });
        });
      });
    },
  },
  created() {
    this.order = this.$route.query.myOrderItem;
  },
};
</script>
<style scoped>
.content {
  padding: 15px;
}
</style>
